package com.example.administrator.mykotlin

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.view.KeyEvent
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_kotlin.*

class KotlinActivity : AppCompatActivity() {

    var type: Int = 1;
    var txt_name: String = "name"

    var number:Int = 0;

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_kotlin)

        txt_hello.text = "第一次Kotlin"
        btn_hello.setOnClickListener {
//            add(25, "人才")
            Log.i("gt",edt_test.text.toString())
        }
    }

    fun add(age: Int, name: String) {
        Toast.makeText(this, "age:" + age + "name" + name, Toast.LENGTH_SHORT).show()
    }

    fun addNumber(age:Int){
        age + 1;
        number = age;
    }

    override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
        return super.onKeyDown(keyCode, event)
    }
}
